package gdut.jmxywz.action;


import gdut.jmxywz.been.Bookmaking;
import gdut.jmxywz.been.Teacher;
import gdut.jmxywz.util.PageModel;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;


public class BookmakingStatisticsAction extends BaseAction{
	
     private Bookmaking bookmaking;
     private String bookmakingAuthor;
     private String bookmakingTitle;
	 private PageModel pageModel;
	 private int bookmakingId;
	 private int currentPage=1;
		
	private int pageSize=15;
	private String bookmakingTime1;
	private String bookmakingTime2;



		
	 /***************show*****************/
		public String show()throws Exception{
			String hql=" from Bookmaking  where auditing != 0 and auditing !=3";
			hql = hql +" order by bookmakingId desc,auditing desc";
			pageModel=this.getCommonService().findPage(hql, null, currentPage, pageSize,null,"");
			return SUCCESS;
		}
		
		
		
		
		/***************详细*****************/
		public String detail() throws Exception {
			// TODO Auto-generated method stub
			System.out.println("******************");
			System.out.println(bookmakingId);
			bookmaking=(Bookmaking)this.getCommonService().findByIntId(bookmakingId, "gdut.jmxywz.been.Bookmaking");
			System.out.println(bookmaking.getBookmakingId());
			System.out.println("******************");
			if(bookmaking==null)
				return "error";
			else
				return SUCCESS;
		}
		
		/**************查询****************/
		public String findByHql() throws Exception {
			
			String hql=" from Bookmaking  where auditing != 0 and auditing !=3";
			System.out.println("++++++++++++++++++");
			System.out.println(bookmakingAuthor);
			//
			HttpServletRequest request = ServletActionContext.getRequest();
			bookmakingTitle=new String(request.getParameter("bookmakingTitle").getBytes("ISO-8859-1"),"UTF-8");
			//HttpServletRequest request1 = ServletActionContext.getRequest();
			bookmakingAuthor=new String(request.getParameter("bookmakingAuthor").getBytes("ISO-8859-1"),"UTF-8");
			//
			if(null!=bookmakingTitle){           
				hql = hql+" and bookmakingTitle  like '%"+bookmakingTitle+"%'  ";
			}
			if(null!=bookmakingAuthor){           
				hql = hql+" and bookmakingAuthor  like '%"+bookmakingAuthor+"%'  ";
			}
			
			pageModel=this.getCommonService().findPage(hql, null, currentPage, pageSize,null,"");
			return SUCCESS;
		}


		public Bookmaking getBookmaking() {
			return bookmaking;
		}




		public void setBookmaking(Bookmaking bookmaking) {
			this.bookmaking = bookmaking;
		}




		public PageModel getPageModel() {
			return pageModel;
		}




		public void setPageModel(PageModel pageModel) {
			this.pageModel = pageModel;
		}




		public int getBookmakingId() {
			return bookmakingId;
		}




		public void setBookmakingId(int bookmakingId) {
			this.bookmakingId = bookmakingId;
		}




		public int getCurrentPage() {
			return currentPage;
		}




		public void setCurrentPage(int currentPage) {
			this.currentPage = currentPage;
		}




		public int getPageSize() {
			return pageSize;
		}




		public void setPageSize(int pageSize) {
			this.pageSize = pageSize;
		}




		public String getBookmakingAuthor() {
			return bookmakingAuthor;
		}




		public void setBookmakingAuthor(String bookmakingAuthor) {
			this.bookmakingAuthor = bookmakingAuthor;
		}




		public String getBookmakingTitle() {
			return bookmakingTitle;
		}




		public void setBookmakingTitle(String bookmakingTitle) {
			this.bookmakingTitle = bookmakingTitle;
		}




		public String getBookmakingTime2() {
			return bookmakingTime2;
		}




		public void setBookmakingTime2(String bookmakingTime2) {
			this.bookmakingTime2 = bookmakingTime2;
		}




		public String getBookmakingTime1() {
			return bookmakingTime1;
		}




		public void setBookmakingTime1(String bookmakingTime1) {
			this.bookmakingTime1 = bookmakingTime1;
		}

		
		
		
	
	
	    
	    

		
		
		
		
		
		
		
	
}
